'use strict';

const BaseModel = require('./BaseModel');

/**
 * 用户角色
 */
class AdminRolesModel extends BaseModel {

  constructor() {
    super('admin_role_menu_rel', 'id');

    this.entity = class entity {
      constructor() {
        this.roleId = null;
        this.menuId = null;
        this.defaultRightsType = null;
        this.creator = null;
        this.createTime = null;
        this.updateTime = null;
      }
    };
  }

  async deleteByRoleId_transaction(conn, roleId) {
    const sql = `delete from ${this.tableName} where role_id = '${roleId} '`;
    const result = await conn.query(sql);
    if (result) {
      return result;
    }
    return null;
  }
  
}

module.exports = AdminRolesModel;

